﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LanguageTraning
{
    class AutoImplementedProperties
    {
        public void TestMethod()
        {
            Console.WriteLine("---------------------------------------------");
            Console.WriteLine("this is example of {0}", this.GetType().ToString());

            // Intialize a new object.
            Customer cust1 = new Customer(4987.63, "Northwind", 90108);
            //Modify a property
            cust1.TotalPurchases += 499.99;
            Console.WriteLine(cust1.ToString());

        }
    }


    // This class is mutable. Its data can be modified from
    // outside the class.
    class Customer
    {
        // Auto-Impl Properties for trivial get and set
        public double TotalPurchases { get; set; }
        public string Name { get; set; }
        public int CustomerID { get; set; }

        // Constructor
        public Customer(double purchases, string name, int ID)
        {
            TotalPurchases = purchases;
            Name = name;
            CustomerID = ID;
        }
        // Methods
        public string GetContactInfo() { return "ContactInfo"; }
        public string GetTransactionHistory() { return "History"; }

    }


}
